package top.gokzzz.notice.factory;

import top.gokzzz.notice.constant.MessageType;
import top.gokzzz.notice.sender.EmailSender;
import top.gokzzz.notice.sender.MessageSender;
import top.gokzzz.notice.sender.PushSender;
import top.gokzzz.notice.sender.SmsSender;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

/**
 * 消息發送工廠類
 *
 * @author Gok
 */
public class MessageSenderFactory {

    public static List<MessageSender> getMessageSenders(Set<MessageType> types) {
        List<MessageSender> senders = new ArrayList<>();
        for (MessageType type : types) {
            switch (type) {
                case SMS:
                    senders.add(new SmsSender());
                    break;
                case EMAIL:
                    senders.add(new EmailSender());
                    break;
                case PUSH:
                    senders.add(new PushSender());
                    break;
                default:
                    throw new IllegalArgumentException("Unsupported message type: " + type);
            }
        }
        return senders;
    }
}